package com.yd.app.service.pc.analysisService;

import com.yd.app.mapper.AnalysisMapper;
import com.yd.app.service.common.BaseService;
import com.yd.domain.business.AnalySum;
import com.yd.domain.business.Analysis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zy
 * @create 2018-04-24 9:31
 * @desc 统计分析
 **/
@Service
public class AnalysisService extends BaseService {
    @Autowired
    AnalysisMapper analysisMapper;
    /**
     * @Author: zy
     * @Desc: 按照类型进行统计
     * @Date:  2018/4/24
     * @Param
     */
    public List<Analysis> analysisByGStyle(Analysis a) {
        List<Analysis> list=null;
        list=analysisMapper.analysisByGStyle(a);
        if(list==null){
            list=new ArrayList<>();
        }
        return list;
    }
    /**
     * @Author: zy
     * @Desc: 按照材质进行统计
     * @Date:  2018/4/24
     * @Param
     */
    public List<Analysis> analysisByType(Analysis a) {
        List<Analysis> list=null;
        list=analysisMapper.analysisByType(a);
        if(list==null){
            list=new ArrayList<>();
        }
        return list;
    }
    /**
     * @Author: zy
     * @Desc: 统计合计
     * @Date:  2018/4/24
     * @Param
     */
    public AnalySum getSumByGStyle(Analysis a) {
        AnalySum analySum=null;
        analySum=analysisMapper.getSumByGStyle(a);
        if(analySum==null){
            analySum=new AnalySum();
        }
        return analySum;
    }
}
